package benworks.bookcode.wsjc.suggestion120;

/**
 * 1.stop方法是过时的 2.stop方法会导致代码逻辑不完整 3.stop方法会破坏原子逻辑
 * 
 * @author Ben
 */
public class DonotUseStop {

	public static void main(String[] args) throws InterruptedException {
		// 子线程
		Thread thread = new Thread() {
			@Override
			public void run() {
				// 子线程休眠1秒
				try {
					Thread.sleep(1000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		};

		// 启动线程
		thread.start();
		// 主线程休眠0.1s
		Thread.sleep(100);
		// 子线程停止
		thread.stop();

	}
}
